package gui;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

import settings.guiSettings;

public class SingleField extends JPanel {
	private static final long serialVersionUID = -8654437029707665071L;
	private boolean isset = false;
	public SingleField(int posX, int posY) {
		setBackground(Color.WHITE);
		setLocation(posX + 1, posY + 1);
		setSize(20, 20);
		setBorder(BorderFactory.createLineBorder(Color.BLACK));
		addMouseListener(new MouseListener() {
			public void mouseReleased(MouseEvent arg0) {}
			public void mousePressed(MouseEvent arg0) {}
			public void mouseExited(MouseEvent arg0) {
				setBorder(BorderFactory.createLineBorder(Color.BLACK));
				repaint();
			}
			public void mouseEntered(MouseEvent arg0) {
				if (!isset)
					setBorder(BorderFactory.createLineBorder(new Color(0xEF952C)));
				else setBorder(BorderFactory.createLineBorder(Color.RED));
				repaint();
			}
			public void mouseClicked(MouseEvent arg0) {
				setBorder(BorderFactory.createLineBorder(Color.BLUE));
				setBackground(guiSettings.GAMECOLOR_BLUE);
				isset = true;
				repaint();
			}
		});
	}
}
